package com.example.prom.ok.y2023.work.tencentCloud;

import com.alibaba.fastjson.JSON;
import com.tencentcloudapi.billing.v20180709.BillingClient;
import com.tencentcloudapi.billing.v20180709.models.DescribeAccountBalanceRequest;
import com.tencentcloudapi.billing.v20180709.models.DescribeAccountBalanceResponse;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
import com.tencentcloudapi.common.profile.ClientProfile;
import com.tencentcloudapi.common.profile.HttpProfile;

public class GetBalance {
    private static final String secretId = "IKIDzsdBa0QT3wnRyNYYTkN0VVSXg0cBh5LV";
    private static final String secretKey = "BMXaWfcxBMW1N1gTUey7hFb5eAk2FOUO";




    public static void main(String[] args) throws TencentCloudSDKException {
        try{

            Credential cred = new Credential(secretId, secretKey);
            // 实例化一个http选项
            HttpProfile httpProfile = new HttpProfile();
            httpProfile.setEndpoint("billing.tencentcloudapi.com");
            // 实例化一个client选项
            ClientProfile clientProfile = new ClientProfile();
            clientProfile.setHttpProfile(httpProfile);
            // 实例化要请求产品的client对象
            BillingClient client = new BillingClient(cred, "ap-singapore", clientProfile);
            // 实例化一个请求对象,每个接口都会对应一个request对象
            DescribeAccountBalanceRequest req = new DescribeAccountBalanceRequest();

            // 返回的resp是一个DescribeAccountBalanceResponse的实例，与请求对象对应
            DescribeAccountBalanceResponse resp = client.DescribeAccountBalance(req);
            // 输出json格式的字符串回包
            System.out.println(DescribeAccountBalanceResponse.toJsonString(resp));
        } catch (TencentCloudSDKException e) {
            System.out.println(e.toString());
        }
    }

}
